require("Core/Class")
require("Core/Functions")

local fps = 0
local oneSecond = 0
local t = 0
local nanosuit
function Start()
	print("GameStart")
	
	nanosuit = GameLuaCaller.CreateModel("Assets/Model/Nanosuit/nanosuit.obj", "nanosuit")

	local airplane = GameLuaCaller.CreateModel("Assets/Model/Airplane/ssylph.obj", "airplane")
	airplane:GetTransform():SetPosition(-10, 10, 0)
	airplane:GetTransform():SetScale(0.1, 0.1, 0.1)
	airplane:GetTransform():SetEulerAngles(90, 0, 0)
	
    local plane = GameLuaCaller.CreatePlane(10, 10, 10, 10)
	
	local cube = GameLuaCaller.CreateCube(3.0, 3.0, 3.0)
	local cubeTrans = cube:GetTransform()
	cubeTrans:SetEulerAngles(-40, 0, 45)
	cubeTrans:SetPosition(10, 5, 0)
	
	local sphere = GameLuaCaller.CreateSphere(5.0, 50, 50)
	local sphereTrans = sphere:GetTransform()
    sphereTrans:SetPosition(20, 5, 0)
    sphereTrans:SetParent(cubeTrans)
	
	local robot = GameLuaCaller.CreateRobot(0, 0, 1, 1)
	local robotTrans = robot:GetTransform()
	robotTrans:SetPosition(-20.0, 5.0, 0.0)
	
	--UI
	local image = GameLuaCaller.CreateImage("Assets/Image/zhunxin.png", 100, 100)
    image:SetLayer(1 << 1)
end

function Update(dt)
	fps = fps + 1 
	oneSecond = oneSecond + dt
	if oneSecond > 1 then
		print("fps:" .. fps)
		fps = 0
		oneSecond = 0
	end
	
	-- local root = GameLuaCaller.GetSceneRoot()
	local nanosuitTrans = nanosuit:GetTransform()
	local x,y,z = nanosuitTrans:GetPosition()
	nanosuitTrans:SetPosition(t, y, z)
	

	print("nanosuit pos x:" .. x .. " y:".. y.. " z:" .. z)
	
	t = t + dt
end

function Dispose()
	print("GameDispose")
end